'use client';
import { useTranslations } from 'next-intl';
import { Table, theme, Modal, Button } from 'antd';
import { useRouter } from 'next/navigation';
import AvaForm from './AvaForm';
import { columns, data } from './column';
import Layout from '@/components/Layout';
import styles from './index.module.less';
import { useState } from 'react';
import UseForm from './useform'

export default function User() {
  const t = useTranslations('user');
  const { token } = theme.useToken();

  const listStyle: React.CSSProperties = {
    background: token.colorFillAlter,
    borderRadius: token.borderRadiusLG,
    padding: 12
  };
  const [show, setshow] = useState(false)
  const [title, settitle] = useState('添加')
  return (
    <Layout curActive='/user' >


      <main className={styles.userWrap}>
        <div className={styles.content}>
          <AvaForm />
          <div style={listStyle}>
            <h3>{t('zztList')}</h3>
            {/* 添加按钮 */}
            <Button type="primary" onClick={() => {
              setshow(!show)
              settitle('添加')
              setTimeout(() => {
                setshow(false)
              }
                , 500)
            }}>
              添加
            </Button>

            <UseForm show={show} title={title}></UseForm>
            <Table columns={columns} dataSource={data} pagination={{ pageSize: 3 }} scroll={{ x: 1000 }} />
          </div>
        </div>
      </main>
    </Layout>

  );
}
